<@tools.fileExist type='file' path=path><#assign exists=object&&path?has_content></@tools.fileExist>
<#if path?has_content>
    <#assign
        editorType={'css':'css','js':'javascript','xml':'xml'}
        fileType=path?keep_after_last('.')?lower_case
    />
</#if>
<form method="post" autocomplete="off" action="cmsWebFile/save<#if !exists>?callbackType=closeCurrent&navTabId=cmsWebFile/list</#if>" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
    <input type="hidden" name="_csrf" value="<@tools.csrfToken admin=true/>"/>
    <div class="formBar card">
        <ul>
            <#if exists>
                <li><a class="button" href="cmsWebFile/delete?paths=${(path?url)!}&callbackType=closeCurrent&navTabId=cmsWebFile/list&_csrf=<@tools.csrfToken admin=true/>" title="<@t.page 'confirm.delete_file'/>" target="ajaxTodo"><i class="icon-trash icon-large"></i><@t.page 'button.delete'/></a></li>
            </#if>
            <li><button type="submit" class="buttonActive" title="ctrl+s"<#if path?has_content> lock-url="common/lock?itemType=file&itemId=${(path?url)!}" close-url="common/unlock?itemType=file&itemId=${(path?url)!}"</#if>><@t.page 'button.save'/></button></li>
        </ul>
    </div>
    <div class="card">
        <h2 class="contentTitle">
            <a class="button" href="cmsWebFile/lookup.html?fullPath=true" target="dialog" mask="true"><@t.page 'webfile'/></a>
            <a class="button" href="cmsFileHistory/list.html?type=file&path=${(path?url)!}" lookupGroup=""><@t.page 'history'/></a>
            <div class="float-right">
                <select class="combox codeTheme">
                <#list codeTheme as k,a>
                    <option value="${k}">${a}</option>
                </#list>
                </select>
            </div>
        </h2>
        <div class="pageFormContent" layoutH>
            <div class="clearfix">
                <label><@t.page 'path'/>:</label>
                <input name="path" class="required" type="text" maxlength="500" size="50" value="${(path)!}<#if !exists>/filename.html</#if>"/>
            </div>
            <div>
                <textarea name="content" class="code" escape="true" mode="${(editorType[fileType])?has_content?then(editorType[fileType],'htmlmixed')}"><@tools.fileContent type='file' path=path>${object!}</@tools.fileContent></textarea>
            </div>
        </div>
    </div>
</form>